﻿using System;
using Web.Pages;
using Controladores;

namespace Web
{
    public partial class _Default : BasePage
    {
        #region Events

        protected new void Page_Load(object sender, EventArgs e)
        {
            if ( !Page.IsPostBack )
            {
                this.CrearSesionNHibernate();
            }
        }

        #endregion

        #region Public Methods

        /// <summary>
        /// Inicializa una sesión de nHibernate
        /// </summary>
        private void CrearSesionNHibernate()
        {
            try
            {
                //Get Session from NHibernateHttpModule..
                SesionControlador.ObtenerSesion();
            }
            catch (Exception ex)
            {
                //string Error = Helpers.ErrorHelper.GetFullExceptionMessage(ex);
                //this.txtServerMessage.Text = "Ocurrió un error al iniciar la aplicación." + Environment.NewLine + Environment.NewLine + "Detalle: " + ex.Message;

                var exceptionDetails = ex.GetExceptionDetails();
                //Response.Write(ex.Message);
                Response.Write(exceptionDetails);
                Response.End();
            }
        }

        #endregion
    }
}